<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
	<title>编辑${view.entityComment}[update${view.entityTypeSimpleName}]</title>
	<meta charset="utf-8"/>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
	<meta name="viewport" content="width=device-width, initial-scale=1"/>
<#noparse>
<block th:replace="fragments/easyui_header::insdep_common_replace">
	<!-- css -->
	<link rel="stylesheet" type="text/css" href="../../webjars/js/jquery-ui/css/no-theme/jquery-ui.custom.min.css" th:href="@{/webjars/js/jquery-ui/css/no-theme/jquery-ui.custom.min.css}"/>
	<link rel="stylesheet" type="text/css" href="../../webjars/themes/insdep/insdep.min.css" th:href="@{/webjars/themes/insdep/insdep.min.css}"/>
	<link rel="stylesheet" type="text/css" href="../../webjars/themes/insdep/commons.css" th:href="@{/webjars/themes/insdep/commons.css}"/>
	<!-- js -->
	<script type="text/javascript" charset="utf-8" src="../../webjars/js/jquery.min.js" th:src="@{/webjars/js/jquery.min.js}"></script>
	<script type="text/javascript" charset="utf-8" src="../../webjars/js/jquery-ui/js/jquery-ui.custom.js" th:src="@{/webjars/js/jquery-ui/js/jquery-ui.custom.js}"></script>
	<script type="text/javascript" charset="utf-8" src="../../webjars/themes/insdep/insdep.min.js" th:src="@{/webjars/themes/insdep/insdep.min.js}"></script>
	<script type="text/javascript" charset="utf-8" src="../../webjars/themes/easyui/js/ext.easyui.js" th:src="@{/webjars/themes/easyui/js/ext.easyui.js}"></script>
	<script type="text/javascript" charset="utf-8" src="../../webjars/themes/easyui/js/commons.js" th:src="@{/webjars/themes/easyui/js/commons.js}"></script>
	<script type="text/javascript" charset="utf-8" src="../../webjars/themes/easyui/js/components.js" th:src="@{/webjars/themes/easyui/js/components.js}"></script>
	<script type="text/javascript" th:inline="javascript">
	/*<![CDATA[*/
	var _contextPath = /*[[@{/}]]*/'\/';
	/*]]>*/
	</script>
</block>
</#noparse>
<script type="text/javascript" th:inline="javascript">
/*<![CDATA[*/
$(document).ready(function(){
	parent.DialogUtils.progress('close');
	
	//加载数据
	var $form = $('#entityForm');
	$form.form('load',/*[[@{/${view.entityTypeSimpleName?replace("([a-z])([A-Z]+)","$1_$2","r")?lower_case}/{${view.pkProperty.propertyName}}(${view.pkProperty.propertyName}=${r"${"}id})}]]*/'');
	function formSubmit(){
        var isValid = $form.form('validate');
        if (!isValid){
            return false;
        }
        DialogUtils.progress({
            text : '数据提交中，请等待....'
        });
        $.ajax({
            type: 'PUT',
            url: /*[[@{/${view.entityTypeSimpleName?replace("([a-z])([A-Z]+)","$1_$2","r")?lower_case}/{id}(id=${r"${"}id})}]]*/ '',
            data: $form.serializeObject(),
            success: function(data) {
                DialogUtils.progress('close');
                if(data){
                    parent.DialogUtils.successTip("修改${view.entityComment}成功.");
				parent.DialogUtils.closeDialogById("update${view.entityTypeSimpleName}");
                }else{
                    DialogUtils.alert("错误提示","修改${view.entityComment}失败.","error");
                }
            },
            error: function(e) {
                DialogUtils.progress('close');
                DialogUtils.alert("错误提示","修改${view.entityComment}错误.","error");
            }
        });
        return;
    }
	
	//退出
	$("#cancelBtn").click(function(){
		parent.DialogUtils.closeDialogById("update${view.entityTypeSimpleName}");
	});
	//提交
	$("#submitBtn").click(function(){
		formSubmit();
	});
<#list view.propertyList as property>
	<#if (!property.isPrimaryKey()
		&& property.propertyName != "id"
		&& property.propertyName != "vcid"
		&& property.propertyName != "createDate" 
		&& property.propertyName != "createOperatorId" 
		&& property.propertyName != "lastUpdateDate" 
		&& property.propertyName != "lastUpdateOperatorId"
		&& property.propertyName != "modifyAble"
		&& property.propertyName != "valid")>
		<#if property.isSimpleValueType()>
			<#if property.propertyTypeSimpleName == 'boolean' || property.propertyTypeSimpleName == 'Boolean'>
	$("#${property.propertyName}").combobox({<#if property.validateExpression??>${property.validateExpression}</#if>});
			<#elseif property.isEnum()>
	$("#${property.propertyName}").combobox({<#if property.validateExpression??>${property.validateExpression}</#if>});
			<#elseif  property.propertyTypeSimpleName == 'Date'>
	$("#${property.propertyName}").combodatetime({<#if property.validateExpression??>${property.validateExpression}</#if>});
			<#else>
	$("#${property.propertyName}").textbox({<#if property.validateExpression??>${property.validateExpression}</#if>});
			</#if>				
		<#else>
	$("#${property.columnName}").textbox({<#if property.validateExpression??>${property.validateExpression}</#if>});
		</#if>
	</#if>
</#list>
});
/*]]>*/
</script>
</head>
<body class="easyui-layout" data-options="fit:true,border:false">
	<div data-options="region:'center',border:false" title="" style="overflow-x: hidden;overflow-y: auto;">
		<form id="entityForm" method="post" class="form">
		<table class="table table-celled edit_form_table">
<#assign view_index=0>
<#list view.propertyList as property>
	<#if (!property.isPrimaryKey()
		&& property.propertyName != "id"
		&& property.propertyName != "vcid"
		&& property.propertyName != "createDate" 
		&& property.propertyName != "createOperatorId" 
		&& property.propertyName != "lastUpdateDate" 
		&& property.propertyName != "lastUpdateOperatorId"
		&& property.propertyName != "modifyAble"
		&& property.propertyName != "valid")>
		<#if property.isSimpleValueType()>
			<tr>
			<#if property.propertyComment??>
				<td class="lable"<#if view_index == 0> width="25%"</#if>>${property.propertyComment}:<#if !property.isNullable()><span class="font-red">*</span></#if></td>
			<#else >
				<!--//TODO:修改字段是否必填,修改其中文名-->
				<td class="lable"<#if view_index == 0> width="25%"</#if>>${property.propertyName}:<#if !property.isNullable()><span class="font-red">*</span></#if></td>
			</#if>
				<td>
					<#if view_index == 0>
					<input id="id" name="id" type="hidden" th:value="${r"${"}id}"/>
					</#if>
			<#if property.propertyTypeSimpleName == 'boolean' || property.propertyTypeSimpleName == 'Boolean'>
					<select id="${property.propertyName}" name="${property.propertyName}">
				<#if property.propertyTypeSimpleName == 'Boolean'>
						<option value="">--- 请选择 ---</option>
				</#if>
						<option value="true">是</form:option>
						<option value="false">否</form:option>
					</select>
			<#elseif property.isEnum()>
					<select id="${property.propertyName}" name="${property.propertyName}">
						<#if !property.isNullable()><option value="">--- 请选择 ---</option></#if>
						<option th:each="${property.propertyName}Temp:${r"${"}${property.propertyName}s}" th:value="${r"${"}${property.propertyName}Temp.code}" th:text="${r"${"}${property.propertyName}Temp.name}" th:selected="${r"${"}${view.entityTypeSimpleName?uncap_first}.${property.propertyName} eq ${property.propertyName}Temp}"></option>
					</select>
			<#elseif  property.propertyTypeSimpleName == 'Date'>
					<input id="${property.propertyName}" name="${property.propertyName}"/>
			<#else>
					<input id="${property.propertyName}" name="${property.propertyName}"/>
			</#if>
				</td>
			</tr>			
		<#else>
			<tr>
			<#if property.propertyComment??>
				<td class="lable"<#if view_index == 0> width="25%"</#if>>${property.propertyComment}:<#if !property.isNullable()><span class="font-red">*</span></#if></td>
			<#else>
				<!--//TODO:修改字段是否必填,修改其中文名-->
				<td class="lable"<#if view_index == 0> width="25%"</#if>>${property.getColumnPropertyName()}:<#if !property.isNullable()><span class="font-red">*</span></#if></td>
			</#if>
				<td>
					<!-- //TODO:修改其显示逻辑 -->
					<input id="${property.columnName}" name="${property.columnPropertyName}"/>
				</td>
			</tr>
		</#if>
		<#assign view_index = view_index + 1 >
	</#if>
</#list>			
		</table>
		</form>
	</div>
	
	<div data-options="region:'south',border:false" title="" style="height: 40px; overflow: hidden;padding-right: 50px;" class="dialog-button">
		<a id="submitBtn" href="javascript:void(0);" style="width: 65px;" class="easyui-linkbutton">提交</a>
	</div>
</body>